{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "outputs": [],
   "source": [
    "import pandas as pd"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "outputs": [
    {
     "data": {
      "text/plain": "             货号   平台\n15855  VBOY1800  平台B\n16381  XDQV5600  平台B\n10242  AGDH5500  平台B\n10540  QTVW5600  平台B\n16311  VBOY1800  平台B\n10225  QTVW5600  平台B\n16607  LCHM9800  平台B\n1077   XHQA3700  平台A\n4794   AGDH5500  平台A\n10596  AXTB3200  平台B\n5396   XHQA3700  平台A\n879    AXTB3200  平台A",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>货号</th>\n      <th>平台</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>15855</th>\n      <td>VBOY1800</td>\n      <td>平台B</td>\n    </tr>\n    <tr>\n      <th>16381</th>\n      <td>XDQV5600</td>\n      <td>平台B</td>\n    </tr>\n    <tr>\n      <th>10242</th>\n      <td>AGDH5500</td>\n      <td>平台B</td>\n    </tr>\n    <tr>\n      <th>10540</th>\n      <td>QTVW5600</td>\n      <td>平台B</td>\n    </tr>\n    <tr>\n      <th>16311</th>\n      <td>VBOY1800</td>\n      <td>平台B</td>\n    </tr>\n    <tr>\n      <th>10225</th>\n      <td>QTVW5600</td>\n      <td>平台B</td>\n    </tr>\n    <tr>\n      <th>16607</th>\n      <td>LCHM9800</td>\n      <td>平台B</td>\n    </tr>\n    <tr>\n      <th>1077</th>\n      <td>XHQA3700</td>\n      <td>平台A</td>\n    </tr>\n    <tr>\n      <th>4794</th>\n      <td>AGDH5500</td>\n      <td>平台A</td>\n    </tr>\n    <tr>\n      <th>10596</th>\n      <td>AXTB3200</td>\n      <td>平台B</td>\n    </tr>\n    <tr>\n      <th>5396</th>\n      <td>XHQA3700</td>\n      <td>平台A</td>\n    </tr>\n    <tr>\n      <th>879</th>\n      <td>AXTB3200</td>\n      <td>平台A</td>\n    </tr>\n  </tbody>\n</table>\n</div>"
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.read_excel(\n",
    "    '2019销售总表.xlsx',\n",
    "    usecols=['货号', '平台']\n",
    ").sample(12)\n",
    "df"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "outputs": [
    {
     "data": {
      "text/plain": "             货号   平台\n4794   AGDH5500  平台A\n10242  AGDH5500  平台B\n879    AXTB3200  平台A\n10596  AXTB3200  平台B\n16607  LCHM9800  平台B\n10540  QTVW5600  平台B\n10225  QTVW5600  平台B\n15855  VBOY1800  平台B\n16311  VBOY1800  平台B\n16381  XDQV5600  平台B\n1077   XHQA3700  平台A\n5396   XHQA3700  平台A",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>货号</th>\n      <th>平台</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>4794</th>\n      <td>AGDH5500</td>\n      <td>平台A</td>\n    </tr>\n    <tr>\n      <th>10242</th>\n      <td>AGDH5500</td>\n      <td>平台B</td>\n    </tr>\n    <tr>\n      <th>879</th>\n      <td>AXTB3200</td>\n      <td>平台A</td>\n    </tr>\n    <tr>\n      <th>10596</th>\n      <td>AXTB3200</td>\n      <td>平台B</td>\n    </tr>\n    <tr>\n      <th>16607</th>\n      <td>LCHM9800</td>\n      <td>平台B</td>\n    </tr>\n    <tr>\n      <th>10540</th>\n      <td>QTVW5600</td>\n      <td>平台B</td>\n    </tr>\n    <tr>\n      <th>10225</th>\n      <td>QTVW5600</td>\n      <td>平台B</td>\n    </tr>\n    <tr>\n      <th>15855</th>\n      <td>VBOY1800</td>\n      <td>平台B</td>\n    </tr>\n    <tr>\n      <th>16311</th>\n      <td>VBOY1800</td>\n      <td>平台B</td>\n    </tr>\n    <tr>\n      <th>16381</th>\n      <td>XDQV5600</td>\n      <td>平台B</td>\n    </tr>\n    <tr>\n      <th>1077</th>\n      <td>XHQA3700</td>\n      <td>平台A</td>\n    </tr>\n    <tr>\n      <th>5396</th>\n      <td>XHQA3700</td>\n      <td>平台A</td>\n    </tr>\n  </tbody>\n</table>\n</div>"
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.sort_values(['货号', '平台'])"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "outputs": [
    {
     "data": {
      "text/plain": "             货号   平台\n10242  AGDH5500  平台B\n4794   AGDH5500  平台A\n10596  AXTB3200  平台B\n879    AXTB3200  平台A\n16607  LCHM9800  平台B\n10540  QTVW5600  平台B\n10225  QTVW5600  平台B\n15855  VBOY1800  平台B\n16311  VBOY1800  平台B\n16381  XDQV5600  平台B\n1077   XHQA3700  平台A\n5396   XHQA3700  平台A",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>货号</th>\n      <th>平台</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>10242</th>\n      <td>AGDH5500</td>\n      <td>平台B</td>\n    </tr>\n    <tr>\n      <th>4794</th>\n      <td>AGDH5500</td>\n      <td>平台A</td>\n    </tr>\n    <tr>\n      <th>10596</th>\n      <td>AXTB3200</td>\n      <td>平台B</td>\n    </tr>\n    <tr>\n      <th>879</th>\n      <td>AXTB3200</td>\n      <td>平台A</td>\n    </tr>\n    <tr>\n      <th>16607</th>\n      <td>LCHM9800</td>\n      <td>平台B</td>\n    </tr>\n    <tr>\n      <th>10540</th>\n      <td>QTVW5600</td>\n      <td>平台B</td>\n    </tr>\n    <tr>\n      <th>10225</th>\n      <td>QTVW5600</td>\n      <td>平台B</td>\n    </tr>\n    <tr>\n      <th>15855</th>\n      <td>VBOY1800</td>\n      <td>平台B</td>\n    </tr>\n    <tr>\n      <th>16311</th>\n      <td>VBOY1800</td>\n      <td>平台B</td>\n    </tr>\n    <tr>\n      <th>16381</th>\n      <td>XDQV5600</td>\n      <td>平台B</td>\n    </tr>\n    <tr>\n      <th>1077</th>\n      <td>XHQA3700</td>\n      <td>平台A</td>\n    </tr>\n    <tr>\n      <th>5396</th>\n      <td>XHQA3700</td>\n      <td>平台A</td>\n    </tr>\n  </tbody>\n</table>\n</div>"
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.sort_values(['货号', '平台'],ascending=[True, False])"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "\n"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  },
  "pycharm": {
   "stem_cell": {
    "cell_type": "raw",
    "source": [],
    "metadata": {
     "collapsed": false
    }
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}